
from rest_framework import serializers
from myclass import models
# Create your models here.
class ClassSer(serializers.ModelSerializer):
    class Meta:
        fields='__all__'
        model=models.ClassModel
class GoodsSer(serializers.ModelSerializer):
    myclas=serializers.SerializerMethodField(read_only=True)
    def get_myclas(self,obj):
        return obj.clas.name
    class Meta:
        fields='__all__'
        model=models.GoodsModel
